<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>d2CrudPlus.crud | d2-crud-plus</title>
    <meta name="generator" content="VuePress 1.5.2">
    <link rel="icon" href="/d2-crud-plus/icon-only.png">
    <link rel="manifest" href="/d2-crud-plus/manifest.json">
    <link rel="apple-touch-icon" href="/d2-crud-plus/icons/apple-touch-icon-152x152.png">
    <link rel="mask-icon" href="/d2-crud-plus/icons/safari-pinned-tab.svg" color="#3eaf7c">
    <meta name="description" content="d2-crud-plus doc">
    <meta name="theme-color" content="#3eaf7c">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="msapplication-TileImage" content="/icons/msapplication-icon-144x144.png">
    <meta name="msapplication-TileColor" content="#000000">
    <link rel="preload" href="/d2-crud-plus/assets/css/0.styles.094573b2.css" as="style"><link rel="preload" href="/d2-crud-plus/assets/js/app.920fe806.js" as="script"><link rel="preload" href="/d2-crud-plus/assets/js/2.9f3ba775.js" as="script"><link rel="preload" href="/d2-crud-plus/assets/js/61.9c91c70f.js" as="script"><link rel="prefetch" href="/d2-crud-plus/assets/js/10.768312da.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/11.88f0302a.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/12.0a517745.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/13.a305030c.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/14.d7129909.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/15.1ff1eab0.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/16.b84cb74e.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/17.0e17fa97.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/18.b4667ec6.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/19.4a1d2603.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/20.e542b5eb.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/21.bea29276.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/22.5834f6ce.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/23.d514eada.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/24.10003849.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/25.238b33f6.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/26.64d5f744.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/27.20999cf2.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/28.a0ae569e.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/29.958d25f6.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/3.6fc0af51.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/30.5daeb87d.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/31.8f2a2581.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/32.bf1a9e00.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/33.fb5669a4.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/34.38bf074e.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/35.4789523c.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/36.5e0ded16.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/37.8b00f742.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/38.49c29967.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/39.f40a50c6.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/4.6d40d8fb.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/40.6422ce3c.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/41.76e6d756.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/42.2571374a.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/43.0e62c77f.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/44.59d7ad10.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/45.81bb2ffe.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/46.712a33f6.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/47.6a6f286c.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/48.25afab63.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/49.f6fd43e8.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/5.8571b144.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/50.5a933b10.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/51.fff19aba.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/52.5b7aa258.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/53.e207b0e8.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/54.c28e9900.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/55.23098b29.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/56.dd2936c0.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/57.e7938457.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/58.d206d759.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/59.066b3e6d.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/6.8660d829.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/60.f55b15a6.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/62.bf4ab90c.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/63.1ba8b586.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/64.53572d02.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/65.ba75d2b6.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/66.3b137930.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/67.3f157fd4.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/68.f1e28a8c.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/69.b8844926.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/7.d8550247.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/70.bb6afb7e.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/71.aa8ba6ae.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/8.b8c6f50a.js"><link rel="prefetch" href="/d2-crud-plus/assets/js/9.bb5c3b5b.js">
    <link rel="stylesheet" href="/d2-crud-plus/assets/css/0.styles.094573b2.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/d2-crud-plus/" class="home-link router-link-active"><!----> <span class="site-name">d2-crud-plus</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/d2-crud-plus/guide/" class="nav-link router-link-active">
  指南
</a></div><div class="nav-item"><a href="http://qiniu.veryreader.com/D2CrudPlusExample/index.html" target="_blank" rel="noopener noreferrer" class="nav-link external">
  演示
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <a href="https://github.com/greper/d2-crud-plus" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/d2-crud-plus/guide/" class="nav-link router-link-active">
  指南
</a></div><div class="nav-item"><a href="http://qiniu.veryreader.com/D2CrudPlusExample/index.html" target="_blank" rel="noopener noreferrer" class="nav-link external">
  演示
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <a href="https://github.com/greper/d2-crud-plus" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>指南</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/d2-crud-plus/guide/" class="sidebar-link">介绍</a></li><li><a href="/d2-crud-plus/guide/quickstart.html" class="sidebar-link">快速上手</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>进阶</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/d2-crud-plus/guide/mixins.html" class="active sidebar-link">d2CrudPlus.crud</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/d2-crud-plus/guide/mixins.html#如何工作" class="sidebar-link">如何工作</a></li><li class="sidebar-sub-header"><a href="/d2-crud-plus/guide/mixins.html#暴露的方法" class="sidebar-link">暴露的方法</a></li></ul></li><li><a href="/d2-crud-plus/guide/options.html" class="sidebar-link">crud配置项</a></li><li><a href="/d2-crud-plus/guide/structure.html" class="sidebar-link">数据结构</a></li><li><a href="/d2-crud-plus/guide/component.html" class="sidebar-link">组件配置</a></li><li><a href="/d2-crud-plus/guide/column-type.html" class="sidebar-link">字段类型</a></li><li><a href="/d2-crud-plus/guide/types.html" class="sidebar-link">字段类型列表</a></li><li><a href="/d2-crud-plus/guide/slot.html" class="sidebar-link">slot自定义</a></li><li><a href="/d2-crud-plus/guide/extends.html" class="sidebar-link">自定义扩展</a></li><li><a href="/d2-crud-plus/guide/dict.html" class="sidebar-link">数据字典</a></li><li><a href="/d2-crud-plus/guide/event.html" class="sidebar-link">事件监听</a></li><li><a href="/d2-crud-plus/guide/flat-data.html" class="sidebar-link">数据扁平化</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>附加功能</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/d2-crud-plus/guide/permission.html" class="sidebar-link">权限管理</a></li><li><a href="/d2-crud-plus/guide/generate.html" class="sidebar-link">代码生成</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>更多帮助</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/d2-crud-plus/guide/upgrade.html" class="sidebar-link">版本升级</a></li><li><a href="/d2-crud-plus/guide/breakingchange.html" class="sidebar-link">版本变更说明</a></li><li><a href="/d2-crud-plus/guide/questions.html" class="sidebar-link">常见问题</a></li><li><a href="/d2-crud-plus/guide/contact.html" class="sidebar-link">联系作者</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>extends文档</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/d2-crud-plus/guide/extends/area-selector.html" class="sidebar-link">省市区选择组件</a></li><li><a href="/d2-crud-plus/guide/extends/avatar-cropper.html" class="sidebar-link">头像裁剪上传</a></li><li><a href="/d2-crud-plus/guide/extends/file-uploader.html" class="sidebar-link">文件上传组件</a></li><li><a href="/d2-crud-plus/guide/extends/full-editor.html" class="sidebar-link">富文本</a></li><li><a href="/d2-crud-plus/guide/extends/icon-selector.html" class="sidebar-link">icon选择组件</a></li><li><a href="/d2-crud-plus/guide/extends/tree-selector.html" class="sidebar-link">树形选择组件</a></li><li><a href="/d2-crud-plus/guide/extends/uploader.html" class="sidebar-link">文件上传lib</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>组件文档</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>ChangeLog</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="d2crudplus-crud"><a href="#d2crudplus-crud" class="header-anchor">#</a> d2CrudPlus.crud</h1> <h2 id="如何工作"><a href="#如何工作" class="header-anchor">#</a> 如何工作</h2> <p>d2CrudPlus是通过 crud页面的混入功能开始工作的<br>
混入之后，该crud页面将继承d2CrudPlus.curd的方法</p> <div class="language-html extra-class"><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>template</span><span class="token punctuation">&gt;</span></span>
...
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>template</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>script</span><span class="token punctuation">&gt;</span></span><span class="token script"><span class="token language-javascript">
<span class="token keyword">import</span> <span class="token punctuation">{</span> d2CrudPlus <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'d2-crud-plus'</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  mixins<span class="token punctuation">:</span> <span class="token punctuation">[</span>d2CrudPlus<span class="token punctuation">.</span>crud<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token comment">// 最核心部分，继承d2CrudPlus.crud</span>
<span class="token punctuation">}</span>
</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>script</span><span class="token punctuation">&gt;</span></span>
</code></pre></div><h2 id="暴露的方法"><a href="#暴露的方法" class="header-anchor">#</a> 暴露的方法</h2> <p>以下方法可以根据你的实际情况，进行调用或者在页面的methods中覆盖重写</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">/**
 * 暴露的方法
 */</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  methods<span class="token punctuation">:</span> <span class="token punctuation">{</span>

    <span class="token comment">// --------------页面初始化方法，可以被覆盖--------------</span>
    <span class="token comment">/**
     * 页面初始化，在created中被调用
     * 必要时可以覆盖为空方法，改变初始化的时机
     * @private
     */</span>
    <span class="token function">_OnCreated</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">_doStart</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * initColumns 初始化结束后调用方法
     */</span>
    <span class="token function">initAfter</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 第一次请求页面数据
     * initColumns初始化完成后调用
     */</span>
    <span class="token function">doLoad</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">doRefresh</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token keyword">from</span><span class="token punctuation">:</span> <span class="token string">'load'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">// --------------以下方法，可以被调用，请注意不要覆盖--------------</span>
    <span class="token comment">/**
     * 获取编辑框的formData
     * @returns
     */</span>
    <span class="token function">getD2Crud</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>$refs<span class="token punctuation">[</span><span class="token keyword">this</span><span class="token punctuation">.</span>crud<span class="token punctuation">.</span>format<span class="token punctuation">.</span>ref<span class="token punctuation">.</span>d2Crud<span class="token punctuation">]</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     *  获取 el-table实例
     * @returns {*}
     */</span>
    <span class="token function">getD2CrudTable</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getD2Crud</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>$refs<span class="token punctuation">.</span>elTable
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 获取当前列表数据
     * @returns
     */</span>
    <span class="token function">getD2CrudTableData</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getD2Crud</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>d2CrudData
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 获取编辑框的formData
     * @returns
     */</span>
    <span class="token function">getEditForm</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getD2Crud</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>formData
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token comment">/**
     * 获取编辑框的组件参数配置
     * @returns
     */</span>
    <span class="token function">getEditFormTemplate</span> <span class="token punctuation">(</span><span class="token parameter">key<span class="token punctuation">,</span> groupKey <span class="token operator">=</span> <span class="token keyword">undefined</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getD2Crud</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">getFormTemplate</span><span class="token punctuation">(</span>key<span class="token punctuation">,</span> groupKey<span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token comment">/**
     * 获取编辑框的分组组件参数配置
     * @returns
     */</span>
    <span class="token function">getEditFormTemplateGroup</span> <span class="token punctuation">(</span><span class="token parameter">groupKey<span class="token punctuation">,</span> key</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">getD2Crud</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">getFormTemplateGroup</span><span class="token punctuation">(</span>groupKey<span class="token punctuation">,</span> key<span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 翻页
     * doPageTurn (no){}
     */</span>

    <span class="token comment">/**
     * 刷新页面
     * doRefresh (){}
     */</span>

    <span class="token comment">// --------------以下方法，可以被覆盖重写--------------</span>

    <span class="token comment">/**
     * doRefresh结束后的操作
     */</span>
    <span class="token function">doAfterRefresh</span> <span class="token punctuation">(</span><span class="token parameter">query<span class="token punctuation">,</span> options</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 对话框打开前被调用
     * @param context
     * @private
     */</span>
    <span class="token function">doDialogOpen</span> <span class="token punctuation">(</span><span class="token parameter">context</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/***
     * 对话框打开后被调用（注意：此时组件可能还没有被mounted）
     * @param context { mode,form}
     */</span>
    <span class="token function">doDialogOpened</span> <span class="token punctuation">(</span><span class="token parameter">context</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 编辑对话框取消
     * @param done
     */</span>
    <span class="token function">doDialogCancel</span> <span class="token punctuation">(</span><span class="token parameter">done</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token function">done</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment">// 必须调用，否则无法关闭对话框</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 多选change事件
     * @param selection
     */</span>
    <span class="token function">doSelectionChange</span> <span class="token punctuation">(</span><span class="token parameter">selection</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 单选change事件
     */</span>
    <span class="token function">doCurrentChange</span> <span class="token punctuation">(</span><span class="token parameter">currentRow<span class="token punctuation">,</span> oldCurrentRow</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 全选change事件
     * @param event
     */</span>
    <span class="token function">doSelectAll</span> <span class="token punctuation">(</span><span class="token parameter">event</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 添加数据提交前可以进行修改
     * @param row
     */</span>
    <span class="token function">addBefore</span> <span class="token punctuation">(</span><span class="token parameter">row</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 添加成功提示
     * @param row
     */</span>
    <span class="token function">showAddMessage</span> <span class="token punctuation">(</span><span class="token parameter"><span class="token punctuation">{</span> row <span class="token punctuation">}</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">$message</span><span class="token punctuation">(</span><span class="token punctuation">{</span> message<span class="token punctuation">:</span> <span class="token string">'保存成功'</span><span class="token punctuation">,</span> type<span class="token punctuation">:</span> <span class="token string">'success'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 添加成功后触发
     * @param row
     */</span>
    <span class="token function">addAfter</span> <span class="token punctuation">(</span><span class="token parameter">row</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">doAfterRowChange</span><span class="token punctuation">(</span>row<span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 修改数据提交前可以进行修改
     * @param row
     */</span>
    <span class="token function">editBefore</span> <span class="token punctuation">(</span><span class="token parameter">row</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 显示修改成功的提示
     * @param index
     * @param row
     */</span>
    <span class="token function">showEditMessage</span> <span class="token punctuation">(</span><span class="token parameter"><span class="token punctuation">{</span> index<span class="token punctuation">,</span> row <span class="token punctuation">}</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">$message</span><span class="token punctuation">(</span><span class="token punctuation">{</span> message<span class="token punctuation">:</span> <span class="token string">'保存成功'</span><span class="token punctuation">,</span> type<span class="token punctuation">:</span> <span class="token string">'success'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 修改成功后触发
     * @param row
     */</span>
    <span class="token function">editAfter</span> <span class="token punctuation">(</span><span class="token parameter">row</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">doAfterRowChange</span><span class="token punctuation">(</span>row<span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 修改前可以改变传入数据
     * @param row
     */</span>
    <span class="token function">delBefore</span> <span class="token punctuation">(</span><span class="token parameter">row</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 显示删除成功提示
     */</span>
    <span class="token function">showRemoveMessage</span> <span class="token punctuation">(</span><span class="token parameter"><span class="token punctuation">{</span> index<span class="token punctuation">,</span> row <span class="token punctuation">}</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">$message</span><span class="token punctuation">(</span><span class="token punctuation">{</span> message<span class="token punctuation">:</span> <span class="token string">'删除成功'</span><span class="token punctuation">,</span> type<span class="token punctuation">:</span> <span class="token string">'success'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 删除成功后触发
     * @param row
     */</span>
    <span class="token function">delAfter</span> <span class="token punctuation">(</span><span class="token parameter">row</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">doAfterRowChange</span><span class="token punctuation">(</span>row<span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 行变动之后触发
     * 添加、修改、删除之后触发
     * 默认触发刷新列表
     * @param row
     */</span>
    <span class="token function">doAfterRowChange</span> <span class="token punctuation">(</span><span class="token parameter">row</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">doRefresh</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token keyword">from</span><span class="token punctuation">:</span> <span class="token string">'afterRowChange'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 用户可覆盖的编辑框表单改变事件
     * @param key
     * @param value
     */</span>
    <span class="token function">doFormDataChange</span> <span class="token punctuation">(</span><span class="token parameter"><span class="token punctuation">{</span> key<span class="token punctuation">,</span> value<span class="token punctuation">,</span> form <span class="token punctuation">}</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 搜索框内组件value变化事件
     * @param key
     * @param value
     * @param component
     * @param form
     */</span>
    <span class="token function">doSearchDataChange</span> <span class="token punctuation">(</span><span class="token parameter"><span class="token punctuation">{</span> key<span class="token punctuation">,</span> value<span class="token punctuation">,</span> component<span class="token punctuation">,</span> form <span class="token punctuation">}</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span>

    <span class="token comment">/**
     * 列设置修改后调用
     * @param columns
     */</span>
    <span class="token function">doColumnsFilterChanged</span> <span class="token punctuation">(</span><span class="token parameter">columns</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>

  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/greper/d2-crud-plus/edit/master//d2-crud-plus-docs/guide/mixins.md" target="_blank" rel="noopener noreferrer">在 GitHub 上编辑此页</a> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></div> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2020-8-10 4:30:25 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/d2-crud-plus/guide/quickstart.html" class="prev">
        快速上手
      </a></span> <span class="next"><a href="/d2-crud-plus/guide/options.html">
        crud配置项
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"></div></div>
    <script src="/d2-crud-plus/assets/js/app.920fe806.js" defer></script><script src="/d2-crud-plus/assets/js/2.9f3ba775.js" defer></script><script src="/d2-crud-plus/assets/js/61.9c91c70f.js" defer></script>
  </body>
</html>
